# -*- encoding: utf-8 -*-
'''
file       :qiege.py
Description:切割图像
Date       :2023/01/05 10:32:15
Author     :Josco
version    :python3.7.8
'''
import cv2 as cv
import numpy as np
from config import *


def qiege(pic_path, pic_local, camera):
    pic_img = cv.imread(pic_path)
    pic_width = int(height/3)  # 因为分为3块, 所以是height/3
    if pic_local == 0:
        # 获取
        start_x, stop_x, start_y, stop_y = camera[0]
        lp3 = pic_img[start_x:stop_x, start_y:stop_y]
        first_point_row_col = point_row_col[0]  # 选择照片对应的行列截至位置
        cv.imwrite("./qiege/pic_img_" + str(pic_local) + ".bmp",
                   lp3)  # 存为图像
    elif pic_local == 1:
        start_x, stop_x, start_y, stop_y = camera[1]
        lp3 = pic_img[start_x:stop_x, start_y:stop_y]
        first_point_row_col = point_row_col[1]  # 选择照片对应的行列截至位置
        cv.imwrite("./qiege/pic_img_" + str(pic_local) + ".bmp",
                   lp3)  # 存为图像
    else:
        start_x, stop_x, start_y, stop_y = camera[2]
        lp3 = pic_img[start_x:stop_x, start_y:stop_y]
        first_point_row_col = point_row_col[2]  # 选择照片对应的行列截至位置
        cv.imwrite("./qiege/pic_img_" + str(pic_local) + ".bmp",
                   lp3)  # 存为图像
     
pic_path = "./qiege/1.bmp"
for i in range(3):
    qiege(pic_path, i, camera_2)
